import request from '@/router/axios';

// 查询条件列表 分页
export const getList = (params) => {
    return request({
        url: '/api/manager-api/mx-policy-condition/page',
        method: 'get',
        params
    })
}

// 新增条件
export const save = (data) => {
    return request({
        url: '/api/manager-api/mx-policy-condition/save',
        method: 'post',
        data: data
    })
}

// 获取实体类型
export const latest = (params) => {
    return request({
        url: '/api/manager-api/mx-type/latestReleaseListIncludedBaseObject',
        method: 'get',
        params
    })
}

// 获取关系
export const getRelation = (params) => {
    return request({
        url: '/api/manager-api/mx-reference/listByTypeName',
        method: 'get',
        params
    })
}

// 获取属性字段
export const attributeList = (params) => {
    return request({
        url: '/api/manager-api/mx-attribute/listAllAttribute',
        method: 'get',
        params: params
    })
}

// 条件详情
export const detail = (params) => {
    return request({
        url: '/api/manager-api/mx-policy-condition/detail',
        method: 'get',
        params
    })
}

// 修改条件
export const update = (data) => {
    return request({
        url: '/api/manager-api/mx-policy-condition/update',
        method: 'post',
        data: data
    })
}

// 删除条件
export const del = (params) => {
    return request({
        url: '/api/manager-api/mx-policy-condition/delete',
        method: 'post',
        params
    })
}


/**
 * @param params 启用 策略条件
 * */
export const start = (params) => {
    return request({
        url: '/api/manager-api/mx-policy-condition/startUsing',
        method: 'post',
        params
    })
}

/**
 * @param params 停用 策略条件
 * */
export const stop = (params) => {
    return request({
        url: '/api/manager-api/mx-policy-condition/stopUsing',
        method: 'post',
        params
    })
}

/**
 * @param params 检出 策略条件
 * */
export const checkout = (params) => {
    return request({
        url: '/api/manager-api/mx-policy-condition/checkout',
        method: 'post',
        params
    })
}

/**
 * @param params 检入 策略条件
 * */
export const publish = (params) => {
    return request({
        url: '/api/manager-api/mx-policy-condition/checkin',
        method: 'post',
        params
    })
}

/**
 * @param params 撤销检出 策略条件
 * */
export const unCheckOut = (params) => {
    return request({
        url: '/api/manager-api/mx-policy-condition/revokeCheckout',
        method: 'post',
        params
    })
}
